{% load i18n %}

<div class="app-list-container">
  {% for app in app_list %}
    <div class="app-{{ app.app_label }} module{% if app.app_url in request.path|urlencode %} current-app{% endif %}">
      <div class="app-header">
        <a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
          {{ app.name }}
        </a>
      </div>
      <div class="app-models">
        {% for model in app.models %}
          <div class="model-item{% if model.admin_url in request.path|urlencode %} current-model{% endif %}">
            <div class="model-name">
              {% if model.admin_url %}
                <a href="{{ model.admin_url }}"{% if model.admin_url in request.path|urlencode %} aria-current="page"{% endif %}>
                  {{ model.name }}
                </a>
              {% else %}
                {{ model.name }}
              {% endif %}
            </div>
            <div class="model-actions">
              {% if model.add_url %}
                <a href="{{ model.add_url }}" class="addlink">{% translate 'Add' %}</a>
              {% endif %}
              
              {% if model.admin_url and show_changelinks %}
                {% if model.view_only %}
                  <a href="{{ model.admin_url }}" class="viewlink">{% translate 'View' %}</a>
                {% else %}
                  <a href="{{ model.admin_url }}" class="changelink">{% translate 'Change' %}</a>
                {% endif %}
              {% endif %}
            </div>
          </div>
        {% endfor %}
      </div>
    </div>
  {% endfor %}
</div>

<style>
  .app-list-container {
    margin-top: 20px;
  }
  
  .module {
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
  }
  
  .app-header {
    background: #2c3e50;
    padding: 12px 15px;
  }
  
  .app-header a {
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-decoration: none;
  }
  
  .app-models {
    padding: 10px;
  }
  
  .model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
  }
  
  .model-item:last-child {
    border-bottom: none;
  }
  
  .model-item:hover {
    background: #f5f7fa;
  }
  
  .model-item.current-model {
    background: #f0f7ff;
  }
  
  .model-name {
    flex: 1;
  }
  
  .model-name a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
  }
  
  .model-name a:hover {
    color: #3498db;
  }
  
  .model-actions {
    display: flex;
    gap: 10px;
  }
  
  .model-actions a {
    padding: 5px 10px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
  }
  
  .addlink {
    background: #2ecc71;
    color: white;
  }
  
  .addlink:hover {
    background: #27ae60;
  }
  
  .changelink {
    background: #3498db;
    color: white;
  }
  
  .changelink:hover {
    background: #2980b9;
  }
  
  .viewlink {
    background: #f39c12;
    color: white;
  }
  
  .viewlink:hover {
    background: #d35400;
  }
</style> 